home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 2 / BBS in a box - Trilogy II.iso / Files / Hyper / Q-R / ResGenie™ 1.0 / ResGenie™ / ResGenie™.rsrc / TEXT_175_TCliprez.txt < prev    next >
Encoding:
Text File  |  1993-08-02  |  16.1 KB  |  437 lines

  1. --  colorizeHC "add", "Crayons", "140,190", "140,190,279,268", "transparent"
  2. --  Crayons <--  This is the picture's name
  3.  
  4.  
  5. on mouseUp
  6.    if the short name of me is "Transparent Normal Rez" then
  7.     set the name of me to "Help"
  8.     askfornamehelp
  9.     exit mouseup
  10.   end if
  11.   if the short name of me is help then
  12.     askfornamehelp
  13.     exit mouseup
  14.   end if
  15.   global Tools
  16.   if the shiftkey is down and the commandkey is down then
  17.     checkTools
  18.     if Tools is not "Nope" then
  19.       newResource
  20.       exit mouseup
  21.     else exit mouseup
  22.   end if
  23.   if the commandKey is down then
  24.     newName
  25.     exit mouseup
  26.   end if
  27.   if the shiftkey is down and the optionkey is down then
  28.     changeAttributes
  29.     exit mouseup
  30.   end if
  31.   if the optionkey is down then
  32.     readytoscript
  33.     exit mouseup
  34.   end if
  35.   if the shiftKey is down then
  36.     deletelastColor
  37.     colorizeHC "Erase", rect of me
  38.     set the showName of me to true
  39.     go to this cd
  40.     exit mouseup
  41.   end if
  42.   dothecolor
  43.   pass mouseup
  44. end mouseup
  45.  
  46. on locateMe
  47.   put "-- " && "colorizeHC" && quote & "add" & quote & "," && quote &¬¨
  48.   the short name of me & quote & ","   ¬¨
  49.   && quote & the topleft of me & quote & "," && quote & the rect of me & quote & "," && quote & "transparent" & quote into line 1 of insertLine
  50.   put the script of me into holdScript
  51.   put line 1 of insertLine into line 1 of holdScript
  52.   put "-- " && the short name of me && "<--  This is the picture's name" into line 2 of holdScript
  53.   set the script of me to holdScript
  54. end locateMe
  55.  
  56.  
  57. on newResource
  58.   answer "You are about to import a new resource into your"&&¬¨
  59.   "stack from a PICT file. You may either type in a name now"&&¬¨
  60.   "or locate the PICT file you are going to import with a standard open dialog."¬¨
  61.   with "Cancel" or "Type It" or "Locate"
  62.   if it is "Cancel" then exit newResource
  63.   if it is "Type It" then
  64.     ask "Type your resource name:" with "My Resource"
  65.     if it is empty then exit newResource
  66.     put it into holdPictName
  67.     answer "You will now be asked to locate the picture file that you will call" &&¬¨
  68.     quote & holdPictname & quote && "with a standard"&&¬¨
  69.     "open dialog. (The PICT file name doesn't have to match the name you"&&¬¨
  70.     "have chosen for the resource.)" with "Okay"
  71.   end if
  72.   if it is "Locate" then
  73.     answer file "Choose your picture name by selecting it:" of type PICT
  74.     if it is empty then exit newResource
  75.     put it into process
  76.     get the last char of process
  77.     if it is ":" then
  78.       exit newResource
  79.       answer "Try later with a better picture name." with "I know"
  80.     end if
  81.     if it is not ":" then
  82.       put it into holdPictName
  83.       delete last char of process
  84.       repeat until it is ":"
  85.         get the last char of process
  86.         if it is not ":" then  put it before char 1 of holdPictName
  87.         delete the last char of process -- this could be shorter with
  88.       end repeat -- changing itemDelimiter to ":", but would require HC 2.1
  89.     end if
  90.     answer "You will now be asked to locate the picture file that you will call" &&¬¨
  91.     quote & holdPictname & quote && "with another standard"&&¬¨
  92.     "open dialog. You should now choose the same file again."¬¨
  93.     with "Okay"
  94.   end if
  95.   put reslist () into resData -- This allows a check for duplicate names
  96.   get  offset (holdPictName, resData)  -- of resources since FileToPICTRes does not
  97.   if it is not "0" then
  98.     answer "There is already a resource named" && quote & holdPictName & quote &&¬¨
  99.     "in this stack. Are you sure that you want to replace it with this picture?"¬¨
  100.     with "Replace" or "Cancel"
  101.     if it is "Cancel" then exit newResource
  102.     else
  103.       get FileToPICTRes ( ,holdPictname ,PICT)
  104.       if it is "Cancel" then exit newResource
  105.       else
  106.         put the script of me into holdScript
  107.         set the script of me to holdScript
  108.         set the name of me to holdPictname
  109.         colorizeHC "erase", the rect of me
  110.         set the showName of me to true
  111.         dothecolor
  112.       end if
  113.     end if
  114.   end if
  115. end newResource
  116.  
  117.  
  118.  
  119. on checkTools
  120.   global Tools
  121.   get the short name of this stack
  122.   if it is "ResGenie‚Ñ¢" then
  123.     put "Yep" into Tools
  124.     exit checkTools
  125.   end if
  126.   do get offset ("ResGenie‚Ñ¢", the stacksinuse)
  127.   if it is not "0" then
  128.     put "Yes" into tools
  129.     exit checktools
  130.   end if
  131.   if it is "0" then
  132.     answer "You need to use" && quote & "ResGenie‚Ñ¢" & quote &¬¨
  133.     "for this feature to work." with "Cancel" or "Use"
  134.     if it is "Use" then
  135.       start using stack "ResGenie‚Ñ¢"
  136.       put "Yes" into Tools
  137.     else
  138.       if it is "Cancel" then
  139.         put "Nope" into Tools
  140.       end if
  141.     end if
  142.   end if
  143. end checkTools
  144.  
  145. on newName
  146.   global Tools
  147.   ask "What is the icon name?" with the short name of me
  148.   if it is the short name of me then exit newName
  149.   if it is "Help" then
  150.     checkTools
  151.     get Tools
  152.     if it is "Nope" then exit newname
  153.     set the name of me to "Help"
  154.     colorizeHC "Erase", the rect of me
  155.     askfornamehelp
  156.     exit newName
  157.   end if
  158.   if it is empty then
  159.     set the showName of me to true
  160.     dothecolor
  161.     answer "Every button wants a name even if it's the same OLD name" with "Gotcha"
  162.     exit newName
  163.   end if
  164.   set the name of me to it
  165.   colorizeHC "erase", the rect of me
  166.   set the showName of me to true
  167.   dothecolor
  168. end newName
  169.  
  170.  
  171. on dothecolor
  172.   if the showName of me is true then
  173.     locateMe
  174.     set the showName of me to false
  175.     put line 1 of the script of me into colorCommand
  176.     delete word 1 of colorCommand
  177.     do colorCommand
  178.   else
  179.     if the showName of me is false then
  180.       colorizeHC "erase", rect of me
  181.       set the showname of me to true
  182.     end if
  183.   end if
  184.   go to this cd
  185. end dothecolor
  186.  
  187. on deletebutton
  188.   colorizeHC "erase", the rect of me
  189. end deletebutton
  190.  
  191.  
  192. on readytoScript
  193.   set cursor to watch
  194.   put "Now checking all scripts..."
  195.   global holdScript
  196.   global colorauthoringpath
  197.   get offset ("makeitcolor", the script of this stack)
  198.   if it is "0" then do restext ("TEXT", "colorscriptsmoothe", colorauthoringpath)
  199.   get offset ("on makeitcolor", the script of this bg)
  200.   if it is "0" then do restext ("TEXT", "colorscriptsmoothe", colorauthoringpath)
  201.   get offset ("on makeitcolor", the script of this cd)
  202.   if it is "0" then do restext ("TEXT", "colorscriptsmoothe", colorauthoringpath)
  203.   set the showname of me to true
  204.   dothecolor
  205.   put line 1 of the script of me into line 1 of insertLine
  206.   delete word 1 of insertLine
  207.   put the name of me into check
  208.   if word 1 of check is "bkgnd" then
  209.     put the script of this bg into holdScript
  210.     put "bg" into wheretoGo
  211.     put "send makeitcolor to this cd" into whattoSee
  212.     put the name of this bg into myName
  213.   end if
  214.   if word 1 of check is "card" then
  215.     put the script of this cd into holdScript
  216.     put "cd" into wheretoGo
  217.     put "end makeitcolor" into whattoSee
  218.     put the name of this cd into myName
  219.   end if
  220.   
  221.   get offset (insertLine, holdScript)
  222.   if it is not "0" then
  223.     answer "This picture has already been added here. Do you want to convert this to an ordinary button now?"¬¨
  224.     with "Yes" or "No"
  225.     if it is "Yes" then
  226.       do showdialog 3, "510",  , ,short name of me , "7",,
  227.       if the result is empty then exit readytoscript
  228.       put the result into hold
  229.       if line 1 of hold is "6" then set the style of me to "Transparent"
  230.       if line 1 of hold is "5" then
  231.         put word 1 to 2 of the  name of me && "id" && the id of me into hold
  232.         select hold
  233.         domenu "Clear Button"
  234.         choose browse tool
  235.         set lockscreen to true
  236.         opencard
  237.         exit readytoscript
  238.       end if
  239.       set the name of me to line 2 of hold
  240.       put "on mouseup" into line 1 of temp
  241.       put "   " into line 2 of temp
  242.       put "end mouseup" into line 3 of temp
  243.       set the script of me to temp
  244.     end if
  245.     exit readytoscript
  246.     if it is "No" then exit readytoscript
  247.   end if
  248.   put quote & rect of me & quote into checkRegion
  249.   get offset (checkRegion, holdScript)
  250.   if it is  "0" then
  251.     do put offset (whattoSee, holdscript)  into whereGo
  252.     put insertLine & return before char  whereGo of holdScript -- this should add the new colors
  253.     do set the script of  myName to holdScript
  254.     do put "This picture has been added to" && the name of wheretoGo into message
  255.     answer "Do you want to convert this to an ordinary button now?"¬¨
  256.     with "Yes" or "No"
  257.     if it is "Yes" then
  258.       do showdialog 3, "510",  , ,short name of me , "7",,
  259.       if the result is empty then exit readytoscript
  260.       put the result into hold
  261.       if line 1 of hold is "6" then set the style of me to "Transparent"
  262.       if line 1 of hold is "5" then
  263.         put word 1 to 2 of the  name of me && "id" && the id of me into hold
  264.         select hold
  265.         domenu "Clear Button"
  266.         choose browse tool
  267.         set lockscreen to true
  268.         opencard
  269.         exit readytoscript
  270.       end if
  271.       set the name of me to line 2 of hold
  272.       put "on mouseup" into line 1 of temp
  273.       put "   " into line 2 of temp
  274.       put "end mouseup" into line 3 of temp
  275.       set the script of me to temp
  276.     end if
  277.     exit readytoscript
  278.   end if
  279.   if it is not "0" then
  280.     answer "You are painting in an area already painted. This is not necessarily a problem, but painting the same region twice will take longer." ¬¨
  281.     with "Cancel" or "Continue"
  282.   end if
  283.   if it is "Cancel" then exit readytoScript
  284.   if it is "Continue" then
  285.     do put offset (whattoSee, holdscript)  into whereGo
  286.     put insertLine & return before char  whereGo of holdScript -- this should add the new colors
  287.     do set the script of  myName to holdScript
  288.     do put "This overlapping color has been added to" && the name of wheretoGo into message
  289.     answer "Do you want to convert this to an ordinary button now?"¬¨
  290.     with "Yes" or "No"
  291.     if it is "Yes" then
  292.       do showdialog 3, "510",  , ,short name of me , "7",,
  293.       if the result is empty then exit readytoscript
  294.       put the result into hold
  295.       if line 1 of hold is "6" then set the style of me to "Transparent"
  296.       if line 1 of hold is "5" then
  297.         put word 1 to 2 of the  name of me && "id" && the id of me into hold
  298.         select hold
  299.         domenu "Clear Button"
  300.         choose browse tool
  301.         set lockscreen to true
  302.         opencard
  303.         exit readytoscript
  304.       end if
  305.       set the name of me to line 2 of hold
  306.       put "on mouseup" into line 1 of temp
  307.       put "   " into line 2 of temp
  308.       put "end mouseup" into line 3 of temp
  309.       set the script of me to temp
  310.     end if
  311.     exit readytoscript
  312.   end if
  313. end readytoScript
  314.  
  315. on deleteLastColor
  316.   put line 1 of the script of me into line 1 of insertLine
  317.   delete word 1 of insertLine
  318.   put the name of me into check
  319.   if word 1 of check is "bkgnd" then
  320.     put the script of this bg into holdscript
  321.     put "bg" into wheretoGo
  322.     put the name of this bg into myName
  323.   else
  324.     put the script of this cd into holdScript
  325.     put "cd" into wheretoGo
  326.     put the name of this cd into myName
  327.   end if
  328.   get offset (insertLine, holdScript)
  329.   if it is  0 then
  330.     answer "This picture has already been deleted" with "Okay"
  331.     exit deleteLastColor
  332.   end if
  333.   get offset ("add", holdScript)
  334.   if it  is 0 then
  335.     answer "You have already erased all the pictures here" with "I knew that"
  336.     exit deleteLastColor
  337.   end if
  338.   put the number of lines of char 1 to offset(insertLine, holdScript) ¬¨
  339.   of holdscript into KillLine
  340.   delete line KillLine of holdScript
  341.   colorizeHC "Erase", rect of me
  342.   go to this cd
  343.   do put "This picture has been removed from" && the name of wheretoGo into message
  344.   do set the script of myName to holdScript
  345. end deleteLastColor
  346.  
  347. on changeAttributes
  348.   answer "Do you want this button to create a" && quote & "scaling" & quote && "picture?"¬¨
  349.   with "Cancel" or "Scaling" or "Normal"
  350.   if it is "Cancel" then exit changeAttributes
  351.   put the script of me into holdScript
  352.   put offset ("on locateMe", holdScript) into startPoint
  353.   put startPoint into oldStart
  354.   put offset ("end locateMe", holdScript) + 11 into endPoint
  355.   put char startpoint to endPoint of holdScript into newLocateMe
  356.   delete char startpoint to endPoint of holdScript
  357.   put offset ("put", newLocateMe) into startPoint
  358.   put offset ("insertline", newLocateMe) + 10 into endPoint
  359.   delete char startPoint to endPoint of newLocateMe
  360.   -- put offset ("end mouseup", holdScript) + 10 into Destination
  361.   colorizeHC "erase", the rect of me
  362.   set the showName of me to false
  363.   if it is "Normal" then
  364.     --  foop put "-- " && "colorizeHC" && quote & "add" & quote & "," && quote &¬¨
  365.     --  the short name of me & quote & ","   ¬¨
  366.     --  && quote & the topleft of me & quote & "," && quote & the rect of me & quote & "," && quote & "transparent" & quote into line 1 of insertLine -- endfoop
  367.     put offset ("foop", holdScript) + 4 into startpoint
  368.     put offset ("endfoop", holdScript) - 4 into stopPoint
  369.     put char startpoint to stoppoint of holdScript into holdCommand
  370.     answer "Do you want an opaque or transparent picture to be used?" with¬¨
  371.     "Transparent" or "Opaque"
  372.     if it is "Transparent" then
  373.       put offset ("--  && q", holdCommand) into startPoint
  374.       delete char startpoint to startPoint + 1 of holdCommand
  375.       put offset ("--  the", holdCommand) into startPoint
  376.       delete char startpoint to startPoint + 1 of holdCommand
  377.       put return & holdCommand  after line 1 of newLocateme
  378.       put newLocateme & return into char oldStart of holdScript
  379.       colorizeHC "Add", the short name of me, the topleft of me , the rect of me, "transparent"
  380.     end if
  381.     if it is "Opaque" then
  382.       put offset ("the rect of me", holdCommand) into startpoint
  383.       put the number of chars of holdCommand into endPoint
  384.       delete char startpoint to endPoint of holdCommand
  385.       put space & "rect of me & quote into line 1 of insertline" after last char of holdCommand
  386.       put offset ("--  && q", holdCommand) into startPoint
  387.       delete char startpoint to startPoint + 1 of holdCommand
  388.       put offset ("--  the", holdCommand) into startPoint
  389.       delete char startpoint to startPoint + 1 of holdCommand
  390.       put return & holdCommand  after line 1 of newLocateme
  391.       put newLocateme & return into char oldStart of holdScript
  392.       colorizeHC "Add", the short name of me, the topleft of me, the rect of me
  393.     end if
  394.   end if
  395.   if it is "Cancel" then exit changeAttributes
  396.   if it is "Scaling" then
  397.     --  boink put "-- " && "colorizeHC" && quote & "add" & quote & "," && quote &¬¨
  398.     --  the short name of me & quote & ","   ¬¨
  399.     --  && quote & the rect of me & quote & "," &&  "," && quote & "copy with dithering" & quote into line 1 of insertLine -- endboink
  400.     put offset ("boink", holdScript) + 5 into startpoint
  401.     put offset ("endboink", holdScript) - 4 into stopPoint
  402.     put char startpoint to stoppoint of holdScript into holdCommand
  403.     answer "Do you want an opaque or transparent picture to be used?" with¬¨
  404.     "Transparent" or "Opaque"
  405.     if it is "Opaque" then
  406.       put offset ("transparent", holdCommand) into startpoint
  407.       if startpoint is 0 then
  408.         put offset ("--  && q", holdCommand) into startPoint
  409.         delete char startpoint to startPoint + 1 of holdCommand
  410.         put offset ("--  the", holdCommand) into startPoint
  411.         delete char startpoint to startPoint + 1 of holdCommand
  412.         put return & holdCommand  after line 1 of newLocateme
  413.         put newLocateme & return into char oldStart of holdScript
  414.         colorizeHC "Add", the short name of me,  the rect of me ,, "copy with dithering"
  415.       end if
  416.     end if
  417.     if it is "Transparent" then
  418.       put offset ("copy", holdCommand) into startpoint
  419.       if startpoint is 0 then
  420.         put holdCommand into cd fld "Test Run"
  421.         exit changeAttributes
  422.       end if
  423.       put startpoint + 4 into stoppoint
  424.       delete char startpoint to  stoppoint of holdCommand
  425.       put  "transparent" & space before char startpoint of holdCommand
  426.       put offset ("--  && q", holdCommand) into startPoint
  427.       delete char startpoint to startPoint + 1 of holdCommand
  428.       put offset ("--  the", holdCommand) into startPoint
  429.       delete char startpoint to startPoint + 1 of holdCommand
  430.       put return & holdCommand  after line 1 of newLocateme
  431.       put newLocateme & return into char oldStart of holdScript
  432.       colorizeHC "Add", the short name of me,  the rect of me,, "transparent with dithering"
  433.     end if
  434.   end if
  435.   set the script of me to holdScript
  436.   go to this cd
  437. end changeAttributes